/**
 ******************************************************************************
 * @FilePath: \Hero\Lib\ramp.c
 * @Brief: 
 * @Date: 2021-04-20 08:39:21
 * @Author: Rio
 ******************************************************************************
 */
#include "ramp.h"

ramp_t ramp_c = RAMP_DEFAULT_INIT;
ramp_t ramp_w = RAMP_DEFAULT_INIT;
ramp_t ramp_s = RAMP_DEFAULT_INIT;
ramp_t ramp_a = RAMP_DEFAULT_INIT;
ramp_t ramp_d = RAMP_DEFAULT_INIT;
/**
 * @brief set a buff parameter for chassismotor
 * @param None
 * @return None
 * @attention None
 */
void ramp_init(ramp_t *ramp){
	ramp->count = 0;
	ramp->out = 0;
}

float ramp_cal(ramp_t *ramp){
  if(ramp->scale <=0) return 0;
  if (ramp->count++ >= ramp->scale)
    ramp->count = ramp->scale;

  ramp->out = ramp->count / ((float)ramp->scale);
  return ramp->out;
}
